<%@ page import="java.util.Date" %>
<%@ page import="edu.zut.pojo.User" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%--引用jstl--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    request.setAttribute("time1",new Date());
    /*request.setAttribute("imgUlr","**************");*/
    User user = new User("jack", 21);
    User user1 = new User("tom", 22);
    List<User> list = new ArrayList<>();
    list.add(user);
    list.add(user1);
    request.setAttribute("list",list);
    request.getContextPath();
%>
<%=new Date()%>
<p><c:out value="${time}">2021-10-25</c:out></p>
<p><c:set value="xueyin" var="myName" scope="request"></c:set></p>
<p>${myName}</p>
<%--有就显示，没有就给默认--%>
<c:if test="${empty imgUlr}">
    <%--<img src="">--%>
</c:if>
<c:if test="${empty imgUlr}">
    <img src="${imgUlr}">
</c:if>
<%--遍历 var:遍历的结果或者是key   varStatus:遍历的状态  step:步幅
end：遍历的结尾 begin：从哪个元素开始  items：遍历的对象--%>
<c:forEach var="user2" varStatus="status"
           step="1" end="${list.size()}" begin="0" items="${list}">
    <p>姓名：${user2.name}</p>
    <p>年龄：${user2.age}</p>
</c:forEach>

<%--url标签--%>
<%--<c:redirect url=""></c:redirect>--%>
<c:url var="context" scope="session" value="http://www.baidu.com"></c:url>
<a href="${context}">跳转</a>

<form action="${pageContext.request.contextPath}/test" method="get">
    <input type="submit" value="提交">
</form>

</body>
</html>
